package com.sunflower.bath.service.impl;


import java.util.List;
import org.framework.mybatis.Criteria;
import org.sunflower.framework.utils.UUIDUtils;

import com.sunflower.bath.model.JobExecution;
import com.sunflower.bath.service.IJobExecutionService;
import com.sunflower.bath.repository.IJobExecutionRepository;
public class JobExecutionServiceImpl implements IJobExecutionService{

	public List<JobExecution> queryPage(Criteria<JobExecution> param){
		List<JobExecution> list = jobExecutionRepository.queryPage(param); 
		return list;  }

	public Integer queryPageCount(Criteria<JobExecution> param){
		return (Integer) jobExecutionRepository.queryPageCount(param);
	}

	public JobExecution queryEntityById(String id){
		return jobExecutionRepository.queryEntityById(id);
	}

	public String insert(JobExecution record){
		String jobExecutionId = UUIDUtils.shortUuidAddTime();
		record.setJobExecutionId(jobExecutionId);
		int result = jobExecutionRepository.insert(record);
		if ( result != 1) { 
			return "新增任务失败！";
		} 
		return null;
	}

	public String updateByCriteria(Criteria<JobExecution> param){
		int result = jobExecutionRepository.updateByCriteria(param);
		if ( result != 1) { 
			return "修改任务失败！";
		} 
		return null;
	}

	public String deleteById(String id){
		int result = jobExecutionRepository.deleteById(id);
		if ( result != 1) { 
			return "删除任务失败！";
		} 
		return null;
	}

	public String deleteByCriteria(Criteria<JobExecution> param){
		jobExecutionRepository.deleteByCriteria(param);
		return null;
	}

	public void setJobExecutionRepository(IJobExecutionRepository repository) {this.jobExecutionRepository = repository;}
	private IJobExecutionRepository jobExecutionRepository;
}
